#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include<QMouseEvent>
#include"widgets/search/search.h"
#include"widgets/friend/vx_listwidget.h"
#include"widgets/friend/vx_cell.h"
#include"widgets/chat_interface/chat_interface.h"

//托盘技术
#include<QSystemTrayIcon>
#include<QMenu>
#include<QCloseEvent>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QWidget
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void mousePressEvent(QMouseEvent *event);

    void mouseMoveEvent(QMouseEvent *event);

    void closeEvent(QCloseEvent *event);

signals:
    int index(int i);

private slots:
    void onCellClicked(const QString& friendId); // 槽函数声明

private slots:
    void on_pushButton_close_clicked();

    void on_pushButton_1_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

    void on_pushButton_5_clicked();

    void on_pushButton_6_clicked();

    void on_pushButton_7_clicked();

    void on_pushButton_8_clicked();

    void on_pushButton_9_clicked();

    void on_pushButton_10_clicked();

    void pushButton_skin(int i);

    void on_pushButton_add_clicked();

    void onTrayIconActivated(QSystemTrayIcon::ActivationReason reason);
    void onShowActionTriggered();
    void onExitActionTriggered();

private:
    Ui::MainWindow *ui;

    QPoint dragPosition;// 记录鼠标按下时的偏移位置
    QSystemTrayIcon *trayIcon;//托盘图标
    QMenu *trayMenu;//托盘菜单

    chat_interface *chatWidget=nullptr;//聊天界面单例
};
#endif // MAINWINDOW_H
